export default {
  bind(el, binding, vnode) {
    el.__vueClickOutside__ = function (event) {
      if (!(el === event.target || el.contains(event.target))) {
        binding.value(event)
      }
    }
    document.body.addEventListener('click', el.__vueClickOutside__)
  },
  unbind(el) {
    document.body.removeEventListener('click', el.__vueClickOutside__)
    el.__vueClickOutside__ = null
  }
}